Sample Code List - sorted by Category
Updated 14:38 06/03/1996

NOTE:	Sample code is written, blessed, and provided by Newton DTS and maintained by Bruce Thompson.  Please mail bruce@newton.apple.com or ALink: BThompson if you would like to comment, request, submit, or otherwise chat about sample code.

DTS does not necessarily guarantee lack of bugs and/or suitability of samples for home use.  The sample code provided by DTS should run and have some reasonable level of documentation, and will generally illustrate an important point about Newton programming, but should not be viewed as the correct or ideal approach for all occasions.  Design issues vary from application to application, and (good as they are) the DTS engineers occasionally make mistakes.


True Grid	v4-11/25/95	by Bob Ebert	for Newton ToolKit 1.6
	category: Application Design
	keywords: Grid View, Drawing, columns, proto, performance
	description: Implements three different ways to do scrolling "grid" views based on soup data, and evaluates the complexity and performance tradeoffs of each.



DeletionScript	v2-11/25/95	by Jim Schram	for Newton ToolKit 1.6
	category: Application Design
	keywords: Deletion, auto-part, form-part
	description: Demonstrates how to setup and use deletionScripts for auto and form parts.



ChezDTS	v1-	by David Fedor	for Newton ToolKit 1.6
	category: Application Design
	keywords: registry heap food card 
	description: This sample illustrates the most memory-efficient way to create a registry, which various packages can use to provide a pointer to some package data.  The registered packages may be placed on a card and will safely unregister themselves when the card is removed, without causing the "Newton Still Needs the Card" message.



Altered States	v3-6/3/96	by Jim Schram	for Newton ToolKit 1.6
	category: Application Design
	keywords: State Machine, FSM
	description: An example of a Finite State Machine using the protos from protoFSM



protoFSM	v4-6/3/96	by Jim Schram	for Newton ToolKit 1.6
	category: Application Design
	keywords: Finite State Machine, FSM
	description: A set of protos for building Finite State Machines.



Gauges	v2-11/25/95	by Kent Sandvik	for Newton ToolKit
	category: Controls & Other Protos
	keywords: protoGauge max min protoLabelinputline
	description: the Gauges sample shows the following techniques:
		  How to use a protoGauge
		  How to change the max (or min) values of a gauge dynamically
		  How to tie together this with smart use of a protoLabelInputLine 



Glancing	v2-11/25/95	by Kent Sandvik	for Newton ToolKit
	category: Controls & Other Protos
	keywords: protoGlance, protoLabeledBatteryGauge, protoPictureButton
	description: Demonstrates a few system protos.
		  Show how protoGlances work
		  Has a protoLabeledBatteryGauge inside the Glance
		  Shows how protoPictureButtons work



Radio Cluster	v3-11/25/95	by Kent Sandvik	for Newton ToolKit 1.6
	category: Controls & Other Protos
	keywords: protoradiobutton, protoRadioCluster
	description: demonstrates a radio button cluster.
		  Shows how radio clusters and radiobuttons work
		  Shows how to extract info from the radio cluster
		  Shows some fun with view transition effects



NouveauScroll	v1-11/25/95	by Maurice Sharp	for Newton ToolKit 1.6
	category: Controls & Other Protos
	keywords: prototypes, scroll, scrollers
	description: This sample shows how to use the new scrollers. It gives 2 examples, one that uses a vanilla scroller. The other uses accellerated scrolling and feedback.



Soup Tour	v4-11/25/95	by David Levy & Kent Sandvik	for Inspector/Listener
	category: Data Storage (Soups)
	keywords: Soup index entries stores Query Cursor
	description: This is a simple walkthrough of many store and soup functions, including queries and smart index tricks. Check this out using an Inspector Window.



SoupDrink-Newton	v3-2/28/96	by David Fedor	for Newton ToolKit 1.6
	category: Desktop Connectivity
	keywords: DILs, CDIL, FDIL
	description: SoupDrink consists of two applications (one for MacOS, one for Windows) and a Newton package which demonstrate usage of the DILs.  The Newton package uses normal Endpoint comms, and isn't strictly a DIL sample... but it is the "other half" of the Mac and Windows applications.



DILette	v1-1/10/96	by David Fedor	for Other
	category: Desktop Connectivity
	keywords: DILs
	description: DILette is a minimal sample application which shows the very basics of using the DILs.  This is a good place to start to get a very quick overview of the API and what calls are necessary to send and receive data through the DILs.  DILette communicates with the Newton SoupDrink package.



SoupDrink-Desktop	v3-	by David Fedor	for Newton ToolKit 1.6
	category: Desktop Connectivity
	keywords: DILs, CDIL, FDIL
	description: SoupDrink consists of two desktop applications (one for MacOS, one for Windows) and a Newton package which demonstrate usage of the DILs.  The Newton package uses normal Endpoint comms, and isn't strictly a DIL sample... but it is the "other half" of the MacOS and Windows applications.



Mini-Metadata	v1-6/3/96	by Ryan Robertson	for Newton ToolKit 1.6
	category: Desktop Connectivity
	keywords: Connection Kit, Metadata
	description: A simple replacement for the Newton Connection Kit.



Beyond Help	v5-11/25/95	by Bob Ebert & Maurice Sharp	for Newton Book Maker
	category: Digital Books
	keywords: Help Book, Dickens, Tiny Tim, How Do I
	description: Illustrates creation and usage of a custom help book.



BookSample	v4-11/25/95	by Bob Ebert	for Newton Book Maker
	category: Digital books
	keywords: Digital Books, Dickens, Copperfield, Book Maker, Book Reader, Users Guide
	description: A sample book source--the Newton Book Maker User's Manual in Newton Book Reader form.



Up In Smoke	v3323-11/25/95	by Mike Engber	for Newton ToolKit 1.6
	category: Drawing & Graphics
	keywords: Smoke, Clouds, Poof, Drawing, CopyBits, modeMask
	description:  Shows how to achieve the ever popular smoke/poof/scrub effect.  Also illustrates scaling with CopyBits, using modeMask with CopyBits, and using BuildContext to force an update of an area of the screen.



Dot2Dot	v3-11/25/95	by Kent Sandvik	for Newton ToolKit 1.6
	category: Drawing & Graphics
	keywords: view points polygon
	description: Demonstrates the following: 
		  mapping global coordinates to local ones
		  tracking pen clicks and convert them to an array suitable for a polygon
		  view system handling
		  creating arrays in RAM
		  dynamically changing a clPictureView's icon slot



Bitmap	v1-11/25/95	by Bob Ebert & J. Christopher Bell	for Newton ToolKit 1.6
	category: Drawing & Graphics
	keywords: Bitmap, drawing, transform, viewintobitmap, scaling, offset, drawshape, makebitmap
	description: Shows the basics of manipulating bitmap objects & transform on the Newton.



Drawing	v4-11/25/95	by Bob Ebert	for Newton ToolKit 1.6
	category: Drawing & Graphics
	keywords: drawing, polygon, line, point, rectangle, style, font, pict, shape
	description: Demonstrates functions in drawing chapter, shows how to make shapes and display them, as well as how to offset the shapes.



Basic LlamaTalk	v1-11/25/95	by Jim Schram	for Newton ToolKit 1.6
	category: Endpoints
	keywords: LlamaTalk LlamaShare AppleTalk ADSP MNP Echo Server State Machine
	description: Updated LlamaTalk sample for use with Newton 2.0 protoBasicEndpoint.
		
		The Newton component is a simple front-end which demonstrates sending and receiving transactions of various data types.  It makes calls to a protoLlamaTalk user proto which is an encapsulation of EVERYTHING needed to handle ADSP and MNP communications reliably.
		
		The Mac component is a simple back-end which receives transactions and echos back a "hex dump" of the transaction data.  It makes calls to a robust multiple-client communications library built on top of the Mac CommToolBox.  ALL I/O is asynchronous and interrupt-driven.  The library uses no globals and can be called from within an Application, Control Panel, Init, XCommand, 4D External, etc. etc.



Basic Modem	v2-11/25/95	by Jim Schram	for Newton ToolKit 1.6
	category: Endpoints
	keywords: Modem CommScripting Communications
	description: ACME Modem ported to 2.0 Provides an example of CommScripting in the 2.0 world.



Basic Serial	v1-11/25/95	by Jim Schram	for Newton ToolKit 1.6
	category: Endpoints
	keywords: Communications, Serial, ASync, EndPoints, CommScripting
	description: ACME Serial ported to 2.0 Provides an example of CommScripting in the 2.0 world.



Comms FSM	v2-6/3/96	by Jim Schram	for Newton ToolKit 1.6
	category: Endpoints
	keywords: Communications, Endpoint, FSM, State Machine
	description: An example of a Communications Finite State Machine using protoFSM



CreatingALocale	v1-2/28/96	by Henry Cate	for Newton ToolKit 1.6
	category: Localization
	keywords: Localization Locale Bundles
	description: The sample illustrates how to change the Newton  OS Locale Bundle.
		The new locale makes the Newton  PDA use a 24 hour clock, and changes 
		the days of the week & months of the year to appear in lower case.
		



Modem Setup	v2-11/25/95	by Jim Schram	for Newton ToolKit 1.6
	category: Modem Setup
	keywords: Communications, Modem, Installer
	description: Complete installer shell to build custom modem setups for use by the modem enabler system extension.



newtLabelPicker	v1-	by Maurice Sharp	for Newton ToolKit 1.6
	category: NewtApp
	keywords: newtApp, slot editor, proto
	description: Provides a newt slot editor that is based on protoLabelPicker. Also shows you how to create a newt slot editor from any proto.



Checkbook	v7-	by Neil Rhodes & PIE DTS	for Newton ToolKit 1.6
	category: NewtApp
	keywords: Application, Find, Filing, IA, Views, Soups, newtApp
	description: Full application example using newtApp.  Supports routing, filing, find, etc.   See the README for more info.



MonacoTest	v4-11/25/95	by Bob Ebert & J. Christopher Bell	for Newton ToolKit 1.6
	category: Newton Toolkit
	keywords: Fonts monospaced nonproportional printing install package monaco courier
	description: This sample provides a mono-spaced font for use on the Newton (Monaco 9pt) and gives a short demonstration of how to use it on screen and in printing. The most recent font package can substitute courier for monaco when printing to a PostScript printer which contains the necessary fonts.  Now shows how to create packages that will install a font only if necessary.



MooUnit	v1-11/25/95	by Mike Engber	for Newton ToolKit 1.6
	category: Newton Toolkit
	keywords: Unit Import Export, Moo, DeclareUnit, DefineUnit, UnitImport, AliasUnit
	description: Shows how to use the Unit Import/Export mechanism to use data from one package within another package.



Inspector Gadget	v4-11/25/95	by Bob Ebert & Ando Moon	for Newton ToolKit 1.6
	category: NewtonScript
	keywords: Compile, NewtonScript, Hack, Evaluate
	description: Demonstrates using the Compile function to write newtonscript from a Newton unit itself. Has a simple math expression evaluator as well.  Code on the plane...



PictIndex	v1-11/25/95	by Maurice Sharp	for Newton ToolKit 1.6
	category: Pickers, Popups, and Overviews
	keywords: proto, protoPictIndexer, pictures
	description: Demonstrates using protoPictIndexer, which allows you to specify a large picture as a series of selectable small pictures.



ListPickerSamples	v2-	by Stephen Harris, Maurice Sharp	for Newton ToolKit 1.6
	category: Pickers, Popups, and Overviews
	keywords: prototypes, listPicker, protoListPicker
	description: A set of samples showing most of the API's for protoListPicker. Includes array and soup based listPickers.



WhereInTheWorld	v1-11/25/95	by J. Christopher Bell	for Newton ToolKit 1.6
	category: Pickers, Popups, and Overviews
	keywords: protoWorldPicker, protoCountryPicker, protoProvincePicker, protoStatePicker
	description: Shows the map-based pickers.



protoOverview	v1-2/28/96	by Maurice Sharp	for Newton ToolKit 1.6
	category: Pickers, Popups, and Overviews
	keywords: protoOverview, prototypes, protos
	description: How to make protoOverview work.



protoNumberPicker_TDS	v1-	by Jeremy Wyld, Maurice Sharp	for Newton ToolKit 1.6
	category: Pickers, Popups, and Overviews
	keywords: protoNumberPicker, protos
	description: A complete replacement for the system supplied protoNumberPicker in Newton OS 2.0.  The protoNumberPicker_TDS proto has more functionality than the system supplied protoNumberPicker.  It can set the value at run time, handle positive and negative numbers, include the sign in the picker, and has none of protoNumberPicker's drawing glitches.



protoSlimPicker	v1-	by Jeremy Wyld, Maurice Sharp	for Newton ToolKit 1.6
	category: Pickers, Popups, and Overviews
	keywords: picker, protos, listPicker
	description: A slimmer version of protoListPicker. Also featured in Newton Technology Journal Volume II, Number 4.



WordArray	v2-11/25/95	by J. Christopher Bell	for Newton ToolKit 1.6
	category: Recognition
	keywords: word array, GetWordArray, GetScoreArray
	description: This project shows how to access the recognition engine's statistics regarding most-likely words and confidence scores. The GetWordArray and GetScoreArray functions do most of the work in this sample code project.



CharEdit	v2-11/25/95	by J. Christopher Bell & Bob Ebert	for Newton ToolKit 1.6
	category: Recognition
	keywords: CharEdit, template, letter by letter, corrector
	description: This example shows the basics of the CharEdit proto, the letter-by-letter editor built into Newton 2.0.



CustomRoute	v2-11/25/95	by J. Christopher Bell	for Newton ToolKit 1.6
	category: Routing
	keywords: Routing, Transports, Delete, Duplicate, Print, Beam, Mail, Fax
	description: Shows how to set up your routing formats and routeScripts for Newton OS 2.0.



AutoRoute	v3-2/28/96	by J. Christopher Bell	for Newton ToolKit
	category: Routing
	keywords: routing protoActionButton Send printerChooserButton print fax mail beam
	description: This sample shows how to Route data to the Out Box in Newton 2.0 OS without using a protoActionButton. The user interface contains controls to choose transports and Routing Formats, as well as controls for optional item slots (including a printer chooser).



Sound Advice	v3-11/25/95	by Maurice Sharp	for Newton ToolKit 1.6
	category: Sound
	keywords: sound, resources
	description: Shows how to import sounds into NTK and play the sound from NewtonScript.



Bitchin' Piano	v3-11/25/95	by Todd Courtois	for Newton ToolKit 1.6
	category: Sound
	keywords: sound, samplingRate
	description: This sample takes two downloaded sample sounds and changes the pitch to create a two-octave "keyboard".



Sound Tricks	v4-11/25/95	by Todd Courtois	for Newton ToolKit 1.6
	category: Sound
	keywords: Sound samples, ExtractByte, StuffByte, PlaySound, Native
	description: SoundTricks is intended to demonstrate a couple tricks with sound on the Newton, modifying the samplingRate of a sound sample to shift speed and pitch, and using StuffByte and ExtractByte on the actual sound samples to reverse a sound.
		Demonstrates use of native function to give dramatic speed increases.



WhoOwesWhom	v3-	by Bob Ebert & Greg Christie	for Newton ToolKit 1.6
	category: Stationery
	keywords: stationery, newtapp, notes application, three flavors, IOU
	description: Illustrates how to use stationery in a newtApp based application.  All three flavors of newtApp (card, roll, page) are shown, using the same dataDef and viewDefs.  Additionally the same stationery is registered for use with the built-in Notes application.



Extra Change	v3-11/25/95	by Mike Engber	for Newton ToolKit 1.6
	category: System Data & Built In Apps
	keywords: SetExtrasInfo Extras Drawer Icon
	description: This sample app changes it's icon(and text) in the Extras drawer when you tap it.



PeoplePicker	v1-11/25/95	by Stephen Harris	for Newton ToolKit 1.6
	category: System Data & Built In Apps
	keywords: protos, prototypes, protoPeoplePicker, peoplePicker, cardfile, names
	description: Shows how to use the protoPeoplePicker to choose people from the cardfile.



CardFile Extensions	v1-11/25/95	by Bob Ebert & Tony Fang	for Newton ToolKit 1.6
	category: System Data & Built In Apps
	keywords: Stationery, Layout, Names application, cardfile, bizcard, car make model
	description: This sample shows how to extend the built-in Names application by adding new card types, new information to existing card types, new ways of looking at existing cards, and new bizCard formats.



PeriodicElements	v1-11/25/95	by J. Christopher Bell	for Newton ToolKit 1.6
	category: System Services
	keywords: alarm,periodicAlarmEditor
	description: Illustrates using a periodicAlarmEditor in Newton OS 2.0.



Ink Form	v1-11/25/95	by Bob Ebert & J. Christopher Bell	for Newton ToolKit 1.6
	category: Text Input
	keywords: Ink, Text, RichText, Rich Strings, RecToggle, vFixedTextStyle, vFixedInkTextStyle
	description: This example shows how to use Newton 2.0 Recognition and Ink features.  This sample uses the new recConfig frames and manipulates Rich Strings (strings which can include "ink words.")  Includes a custom configed RecToggle, and shows how to use features of clParagraphViews to force ink and text to a given font/size/style and do deferred recognition.



InkTranslate	v1-11/25/95	by J. Christopher Bell	for Newton ToolKit 1.6
	category: Text Input
	keywords: StrokeToPointsArray, ink, shapes,
	description: Turns stroke bundles (one form of digital ink) into points arrays, and from there into shapes to be rendered in a different view.  An improvement on Different Strokes.



QWERTY	v3-11/25/95	by J. Christopher Bell and Maurice Sharp	for Newton ToolKit
	category: Text Input
	keywords: keyboard, qwerty, protoKeypad, protoKeyboard
	description: The QWERTY project shows how to implement an on-screen keyboard which does not prompt for "add-to-dictionary?" or have the "dictionary" icon. This sample project creates a keyboard which looks like the American QWERTY keyboard.



Keys	v4-11/25/95	by Maurice Sharp, J. Christopher Bell	for Newton ToolKit 1.6
	category: Text Input
	keywords: key, protoKeyboard, protoKeypad, clKeyboardView
	description: This shows how to do a keyboard, including using a picture for a keycap and using strings for what the key prints out. The new version shows one of the keys which will 'modify' the visual and output components of another key.



Status Report	v1-11/25/95	by J. Christopher Bell and Bob Ebert	for Newton ToolKit 1.6
	category: Transports
	keywords: status protoStatusTemplate DoProgress statusTemplate
	description: This example shows how to use protoStatusTemplate default templates, custom templates, and the use of the DoProgress(...) function. The example also shows how to structure your application so that the user can close status dialogs and still continue within the application while receiving visual feedback from actions in progress.



ArchiveTransport	v2-	by Ryan Robertson and J. Christopher Bell	for Newton ToolKit 1.6
	category: Transports
	keywords: Transports Communications Routing IOBox protoBasicEndpoint protoFSM
	description: A transport example. This transport's communications code is designed to simulate real communications code using protoFSM (finite state machine) and protoBasicEndpoint. The transport actually sends and receives using a temporary soup.



AdjustoButton	v1-11/25/95	by Maurice Sharp	for Newton ToolKit 1.6
	category: User Interface
	keywords: button, user interface, UI
	description: This sample provides user prototypes for buttons that will automatically adjust themselves to obey the user interface guidelines on button spacing. 2 protos are provided, one for a standalone button (protoAdjustoButton) and one for clusters of buttons (protoAdjustoClusterButton).  The buttons also readjust when their text values are set using SetValue.



PreeferMadnessTNG	v1-2/28/96	by Maurice Sharp, David Fedor	for Newton ToolKit 1.6
	category: User Interface
	keywords: preferences, formulas, protoPrefsRollItem, Prefs
	description: This sample shows how to do application preferences that follow the Newton 2.0 OS user interface. It provides user proto templates to help you out. It also shows how to add formulas to the system Formulas application.



Clock	v2-11/25/95	by Maurice Sharp	for Newton ToolKit 1.6
	category: Views
	keywords: idle, viewIdleScript, time, date
	description: Demonstrates idle script and some time functions.



DatePick	v2-11/25/95	by Bob Ebert	for Newton ToolKit 1.6
	category: Views
	keywords: Month, clMonthView, local scrolling, user proto, date, day
	description: Shows a user proto that implements a clMonthView based date picker like the one found in the preferences or calendar app.  Lots of good stuff about clMonthView in here.



SyncScroll	v1-11/25/95	by J. Christopher Bell	for Newton ToolKit 1.6
	category: Views
	keywords: SyncScroll scroll view height templates
	description: This example shows how to use SyncScroll and how to use the 'height' slot correctly with view templates.



Thumbnail	v1-11/25/95	by Bob Ebert	for Newton ToolKit 1.6
	category: Views
	keywords: clRemoteView clEditView scaling clipping thumbnail
	description: Shows how to use clRemoteView.  Shows how to make a read-only view based on a "live" clEditView.



TabsNStyles	v3-11/25/95	by Kent Sandvik and J. Christopher Bell	for Newton ToolKit 1.6
	category: Views
	keywords: clParagraphView styles tabs
	description: demonstrates:
		  style information in a clParagraphView
		  tab information in a clParagraphView



DragonDrop	v1-11/25/95	by J. Christopher Bell, Jim Speir	for Newton ToolKit 1.6
	category: Views
	keywords: DragAndDrop, Drag, Drop, Views, View System
	description: Illustrates how to use the Drag and Drop API.  Also demonstates how to drag an item and change it's appearance.  The sample will allow any picture or text to be dragged into it. 



ViewScripts	v3-11/25/95	by Bob Ebert & Gabriel Acosta-Lopez	for Newton ToolKit 1.6
	category: Views
	keywords: viewSetupFormScript, viewSetupChildrenScript, viewSetupDoneScript, viewDrawScript, viewQuitScript, viewPostQuitScript, viewClickScript
	description: illustrates order of form, child, done, drawing, click, quit, and postQuit scripts.



Paragraph Scroll	v4-11/25/95
	by Todd Courtois	for Newton ToolKit 1.6
	category: Views
	keywords: scrolling, size, viewOrigin
	description: ParagraphScroll shows one way to scroll a clParagraphView one pixel at a time.  Creates the view, stuffs it full of text, then changes the viewOrigin of the parent repeatedly.


